(defpackage :html
  (:use :cl :tag-pool)
  (:export #:html #:head #:title #:body
           #:p #:div #:span #:br #:hr
           #:a
           #:b #:i #:u
           #:h1 #:h2 #:h3 #:h4 #:h5 #:h6
           #:input #:form #:label #:iframe #:button #:textarea #:fieldset #:legend
           #:link #:script #:style
           #:table #:thead #:tbody #:tr #:th #:td))

(in-package :html)

(deftag html:html)
(deftag html:head)
(deftag html:title)
(deftag html:body)

(deftag html:p)
(deftag html:div)
(deftag html:span)
(deftag html:br)
(deftag html:hr)

(deftag html:a)

(deftag html:b)
(deftag html:i)
(deftag html:u)

(deftag html:h1)
(deftag html:h2)
(deftag html:h3)
(deftag html:h4)
(deftag html:h5)
(deftag html:h6)

(deftag html:label)
(deftag html:input)
(deftag html:textarea)
(deftag html:form :default-attributes (:method "post"))
(deftag html:button)
(deftag html:iframe)
(deftag html:fieldset)
(deftag html:legend)

(deftag html:script :default-attributes (:type "text/javascript"))
(deftag html:link)
(deftag html:style)

(deftag html:table)
(deftag html:thead)
(deftag html:tbody)
(deftag html:tr)
(deftag html:th)
(deftag html:td)


(defmethod requires-end-tag? ((tag html:br))
  (declare (ignore tag))
  nil)

(defmethod requires-end-tag? ((tag html:hr))
  (declare (ignore tag))
  nil)

(defmethod requires-end-tag? ((tag html:input))
  (declare (ignore tag))
  nil)

#|
(html:html
  (html:head
    (html:title "foo" (tag-pool:out (concatenate 'string "bar" "baz"))))
  (html:body
    (dotimes (i 3) (html:p "fsdfsfd" (html:a :href "foo" "dfdgfdsgdg")
                           "dfdsgfgd"))))
|#